#ifndef __EI_MAI_SMART_CAR_H__
#define __EI_MAI_SMART_CAR_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif

/************pnv nna result************/
typedef struct eiMADP_SMART_CAR_RESULT_S {
	union {
		EI_S32      s32Box[4];
		EI_S32      s32Rect[4];
	};
	EI_FLOAT    f32Score;
	EI_S32      s32BoxSmooth[4];
	EI_S32      s32Id;
	EI_S32      s32TkNum;
	EI_S32      s32Orientation;
	EI_DOUBLE   d32TimesTamp;
	EI_S32      s32Clolor;
	EI_S32      s32Type;
} EI_MADP_SMART_CAR_RESULT_S;


typedef struct eiMADP_SMART_CAR_CYCLES_PNV_RESULT_S {
	EI_U32 u32Num;
	EI_MADP_SMART_CAR_RESULT_S stPNVsRect[DEFAULT_NNA_PNV_DET_CONFIG_MAX_DET_CNT];
} EI_MADP_SMART_CAR_CYCLES_PNV_RESULTS_S;

typedef struct eiMADP_SMART_CAR_PERSON_PNV_RESULT_S {
	EI_U32 u32Num;
	EI_MADP_SMART_CAR_RESULT_S stPNVsRect[DEFAULT_NNA_PNV_DET_CONFIG_MAX_DET_CNT];
} EI_MADP_SMART_CAR_PERSON_PNV_RESULTS_S;

/***************licplate nna result********************/
typedef struct eiMADP_SMART_CAR_LPD_RESULT_S {
	EI_S32      s32Rect[4]; //objs rect
	// EI_S32 s32Area;
	EI_U64      u64Timestamp;
	EI_S32      s32Class;
	EI_S32      s32ID;
	EI_FLOAT    f32Score;
	EI_FLOAT    f32Kpts[8];
} EI_MADP_SMART_CAR_LPD_RESULT_S;

typedef struct eiMADP_SMART_CAR_LPD_RESULTS_S {
	EI_U32 u32Num;
	EI_MADP_SMART_CAR_LPD_RESULT_S stLpdRect[DEFAULT_NNA_LICPLATE_DET_CONFIG_MAX_DET_CNT];
} EI_MADP_SMART_CAR_LPD_RESULTS_S;
/**************************lpr**********************************/
typedef struct eiMADP_SMART_CAR_LPR_RESULT_S {
	EI_S32 s32Len;
	EI_U16 u16Data[10];
} EI_MADP_SMART_CAR_LPR_RESULT_S;

typedef struct eiMADP_SMART_CAR_LPR_RESULTS_S {
	EI_U32 u32Num;
	EI_MADP_SMART_CAR_LPR_RESULT_S stLprRect[DEFAULT_NNA_LICPLATE_DET_CONFIG_MAX_DET_CNT];
} EI_MADP_SMART_CAR_LPR_RESULTS_S;

/*********************open car detection************************/
typedef struct eiMADP_SMART_CAR_OPEN_RESULT_S {
	EI_MADP_SMART_CAR_RESULT_S stPnvCar;
	EI_U32 u32CarLpdNum;
	EI_MADP_SMART_CAR_LPR_RESULT_S stLprRect[3];
	EI_MADP_SMART_CAR_LPD_RESULT_S stLpdRect[3];
} EI_MADP_SMART_CAR_OPEN_RESULT_S;


typedef struct eiMADP_SMART_CAR_OPEN_RESULTS_S {
	EI_U32 u32CarNum;
	EI_U32 u32LpdNum;
	EI_MADP_SMART_CAR_OPEN_RESULT_S stCarOpenPnv[DEFAULT_NNA_LICPLATE_DET_CONFIG_MAX_DET_CNT];
} EI_MADP_SMART_CAR_OPEN_RESULTS_S;

/************************close car detection**************************/
typedef struct eiMADP_SMART_CAR_RESULTS_S {

	EI_MADP_SMART_CAR_CYCLES_PNV_RESULTS_S  stCyclesPnv;
	EI_MADP_SMART_CAR_PERSON_PNV_RESULTS_S  stPersonPnv;
	EI_MADP_SMART_CAR_LPD_RESULTS_S         stLpd;
	EI_MADP_SMART_CAR_LPR_RESULTS_S         stLpr;

	EI_MADP_SMART_CAR_OPEN_RESULTS_S        stCarOpen;//double licplate

	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;
	EI_S32 s32FrameId;

	//for nna
	EI_U32 NnaHandle;
	EI_NNA_DST_PNVS_RESULRS_S   stNnaPnvResult;
	EI_NNA_DST_LPD_S            stNnaLpdResult;
	EI_NNA_LPR_RECG_S            stNnaLprResult;
} EI_MADP_SMART_CAR_RESULTS_S;


typedef struct eiMADP_SMART_CAR_VENC_DATA_S {
	EI_VOID *pVStreamData;
	EI_U8 *pu8Addr;
	EI_U32 au32Len;
} EI_MADP_SMART_CAR_VENC_DATA_S;

typedef struct eiMADP_SMART_CAR_CAP_RESULTS_S {
	EI_MADP_SMART_CAR_RESULTS_S *pstCarResult;
	// cap frame image
	EI_MADP_SMART_FRAME_S *pstSmartFrame;
} EI_MADP_SMART_CAR_CAP_RESULTS_S;

typedef struct eiMADP_SMART_CAR_VENC_RESULT_S {
	EI_MADP_SMART_CAR_CAP_RESULTS_S *pstSmartCapResults;
	EI_S32 CarIdx;
} EI_MADP_SMART_CAR_VENC_RESULT_S;

typedef struct eiMADP_SMART_CAR_SNAP_RESULT_S {
	EI_MADP_SMART_CAR_VENC_RESULT_S *pstCarVencResultData;
	EI_MADP_SMART_CAR_VENC_DATA_S *pstBgVencData;
	EI_MADP_SMART_CAR_VENC_DATA_S *pstVencData;
} EI_MADP_SMART_CAR_SNAP_RESULT_S;

typedef EI_S32 (*EI_MADP_SMART_CAR_DATA_CB)
	(EI_HANDLE hCarCap, EI_MADP_SMART_FRAME_S *pstSmartFrame,
	EI_MADP_SMART_CAR_RESULTS_S *pstDetResults, EI_VOID *pPrivData);


typedef EI_S32 (*EI_MADP_SMART_CAR_SnapDataCB)(EI_HANDLE hCarCap,
	EI_MADP_SMART_CAR_SNAP_RESULT_S *pstSmartCarSnapResults, EI_VOID *pPrivData);

/** the attribute of smart motion det*/
typedef struct eiMADP_SMART_CAR_CFG_S {
	EI_BOOL     bLpdEnable;
	EI_BOOL     bPnvEnable;
	EI_BOOL     bLprEnable;
	EI_BOOL     bLpdDrawBoxEnable;
	EI_BOOL     bPnvDrawBoxEnable;
	EI_BOOL     bBgEnable;

	EI_S32      s32CapMode;
	EI_S32      s32CapInterval;
	EI_S32      s32CapJpegQuality;

	EI_U32      u32FrameWidth;
	EI_U32      u32FrameHeight;

	EI_MADP_SMART_CAR_SnapDataCB pfnCapDataCB;
	EI_MADP_SMART_CAR_DATA_CB pfnDataCB;
	EI_VOID *pPrivateData;
} EI_MADP_SMART_CAR_CFG_S;


/** the attribute of smart mbgs cap*/
typedef struct eiMADP_SMART_CAR_ATTR_S {
	/* init attr start*/
	EI_HANDLE Vproc;
	EI_HANDLE Vport;
	EI_HANDLE VencChn;
	EI_HANDLE Det;

	EI_MADP_SMART_CAR_CFG_S smartCarCfg;
	EI_NNA_PNV_CONFIG_S stPnvConfig;
	EI_NNA_LPD_CONFIG_S stLpdConfig;
	EI_NNA_LPR_CONFIG_S stLprConfig;
} EI_MADP_SMART_CAR_ATTR_S;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif /* __EI_MAI_SMART_CAR_H__ */

